package com.example.dayday.exception;

import com.example.dayday.common.ResponseEnum;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class BusinessException extends RuntimeException {

    private Integer code;

    private String message;


    public BusinessException(Integer code){
        this.code = code;
    }

    public BusinessException(String message){
        this.message = message;
    }

    public BusinessException(Integer code, String message){
        this.code = code;
        this.message = message;
    }


    public BusinessException(Integer code, String message, Throwable cause){
        super(cause);
        this.code = code;
        this.message = message;
    }

    public BusinessException(ResponseEnum responseEnum){
        this.message = responseEnum.getMessage();
        this.code = responseEnum.getCode();
    }

    public BusinessException(ResponseEnum responseEnum, Throwable cause){
        super(cause);
        this.code = responseEnum.getCode();
        this.message = responseEnum.getMessage();
    }
}
